<%@ page language="java" contentType="text/html; charset=Utf-8"
    pageEncoding="Utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>    
 <div class="showtxt5" id="announce">系统公告：</div>
        <div class="showtxt6">
        	<div class="wrap_left">
            	<div class="my01">
            		<img width="60" height="60" src='<s:property value="#session.user.photoUrl" />' />
            	</div>
            </div>
        	<div class="wrap_left">
            	<div class="my02">
           			<span class="span10"><s:property value="#session.user.nickName" /></span><br />
					<br />
					<s:if test="setAddress">
						您还未设置地址信息,请点击这里进行&nbsp;&nbsp;<span class="span14"><a href="<%=path%>/userAddrInit.htm">设置</a></span>
					</s:if>
                </div>
            </div>
        </div>
        <div class="clear"></div>
          <div class="my03"><a href="<%=path%>/inituser.htm?read=0">新消息</a>( <span id="messageNum" style="color:#C00;">0</span>) &nbsp;&nbsp;|&nbsp;&nbsp; <a href="<%=path%>/initMyInviteinfo.htm?selectMode=0">待确认邀约</a>( <span id="inviteNum"  style="color:#C00;">0</span> )&nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%=path%>/initBTradingInfo.htm?state=0">待付款</a>( <span id="payNum"  style="color:#C00;">0</span> ) &nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%=path%>/initBTradingInfo.htm?state=2">待确认收货</a>( <span id="receiptNum"  style="color:#C00;">0</span> ) &nbsp;&nbsp;|&nbsp;&nbsp;<a href="<%=path%>/initBTradedInfo.htm?brokerEvaluation=1">待评价</a>( <span id="evaluateNum"  style="color:#C00;">0</span> ) </div>



<script type="text/javascript">
$(document).ready(function() {
	getInviteNum();
	getMessageNum();
	groupTransInfo();
	queryAnnounce();
});

function queryAnnounce() {
	$.ajax({
		url:'queryAnnounce.htm',
		type:'get',
		data:{"rand":Math.random()},
		async:true,
		success:function(json) {
			$("#announce").append(json.am.content);
		}
	});
}

function getInviteNum() {
	$.ajax({
		url:'countMyInvites.htm',
		type:'get',
		data:{"rand":Math.random()},
		async:true,
		success:function(json) {
			$("#inviteNum").html(json.inviteNum);
		}
	});
}

function getMessageNum() {
	$.ajax({
		url:'countMessagesByBuyer.htm',
		type:'get',
		data:{"rand":Math.random()},
		async:true,
		success:function(json) {
			$("#messageNum").html(json.messageNum);
			if (json.messageNum == 0) {
				$("#sm").html("");
			}
			else {
				$("#smCount2").html(json.messageNum);	
			}
			
		}
	});
}

function groupTransInfo() {
	$.ajax({
		url:'groupUserTransInfo.htm',
		type:'get',
		data:{"rand":Math.random()},
		async:true,
		success:function(json) {
			$("#payNum").html(json.payNum);
			$("#evaluateNum").html(json.evaluateNum);
			$("#receiptNum").html(json.receiptNum);
		}
	});
}
</script>